package com.pet_service.config;

import com.pet_service.interceptor.AuthenticationInterceptor;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author 邹全伸
 * @version 1.0
 * @date 2025-10-05 14:50
 */
public class WebMvcConfiguration implements WebMvcConfigurer {
    private String[] includePathPatterns = {"/app/**"};

    private String[] excludePathPatterns={"/app/login/**","/app/home/**","/app/package/**"};

    @Resource
    private AuthenticationInterceptor authenticationInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(this.authenticationInterceptor).
                addPathPatterns(includePathPatterns).excludePathPatterns(excludePathPatterns);
    }
}
